<?php

namespace app\student\model;

use think\Db;

class studentBaseModel
{
    public static function studentBaseModel()
    {
        //

    }


    //查询出学生的所有信息
    public static function selectReport(array $where)
    {
        //select s.*,cls.name as cls_name, c.name as c_name, r.achievement
        //from s_student s
        //LEFT JOIN s_report  r on s.id = r.s_id
        //LEFT JOIN s_classes cls on cls.id = r.cls_id
        //LEFT JOIN s_course c on c.id = r.c_id
        //LEFT JOIN s_teacher t on t.id = r.t_id
        //where s.id = 81
        $result = Db::table('s_student')->alias('s')
                        ->field('s.*,cls.name as cls_name, c.name as c_name, r.achievement')
                        ->leftJoin('s_report r','s.id = r.s_id')
                        ->leftJoin('s_classes cls','cls.id = r.cls_id')
                        ->leftJoin('s_course c','c.id = r.c_id')
                        ->leftJoin('s_teacher t','t.id = r.t_id')
                        ->where($where)->select();
        return $result;
    }

}